<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - cover.info - /home/andres/Programacion/aso_coverage/aso/src/ASO/framework/therapy.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td width="5%"></td>
          <td width="10%" class="headerItem">Current view:</td>
          <td width="35%" class="headerValue"><a href="../../../../../../../../index.html">directory</a> - <a href="index.html">home/andres/Programacion/aso_coverage/aso/src/ASO/framework</a> - therapy.h (source / <a href="therapy.h.func.html">functions</a>)</td>
          <td width="10%"></td>
          <td width="10%" class="headerCovTableHead">Found</td>
          <td width="10%" class="headerCovTableHead">Hit</td>
          <td width="15%" class="headerCovTableHead">Coverage</td>
          <td width="5%"></td>
        </tr>
        <tr>
          <td></td>
          <td class="headerItem">Test:</td>
          <td class="headerValue">cover.info</td>
          <td class="headerItem">Lines:</td>
          <td class="headerCovTableEntry">25</td>
          <td class="headerCovTableEntry">25</td>
          <td class="headerCovTableEntryHi">100.0 %</td>
        </tr>
        <tr>
          <td></td>
          <td class="headerItem">Date:</td>
          <td class="headerValue">2010-08-03</td>
          <td class="headerItem">Functions:</td>
          <td class="headerCovTableEntry">7</td>
          <td class="headerCovTableEntry">7</td>
          <td class="headerCovTableEntryHi">100.0 %</td>
        </tr>
                <tr><td><img src="../../../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../../../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<a name="1"><span class="lineNum">       1 </span>                : /**</a>
<span class="lineNum">       2 </span>                :  * \file  therapy.h
<span class="lineNum">       3 </span>                :  * \brief Definition of TherapyNode and Therapy class.
<span class="lineNum">       4 </span>                :  *
<span class="lineNum">       5 </span>                :  * ASO: Antiviral Sequence Optimizer
<span class="lineNum">       6 </span>                :  * &lt;http://aso.googlecode.com/&gt;
<span class="lineNum">       7 </span>                :  * Copyright (C) 2010 Velez Ezequiel, Peralta Andres, FuDePAN
<span class="lineNum">       8 </span>                :  *
<span class="lineNum">       9 </span>                :  * This file is part of the ASO project.
<span class="lineNum">      10 </span>                :  *
<span class="lineNum">      11 </span>                :  * Contents:       Header file for ASO providing classes TherapyNode and Therapy.
<span class="lineNum">      12 </span>                :  *
<span class="lineNum">      13 </span>                :  * System:         ASO
<span class="lineNum">      14 </span>                :  * Language:       C++
<span class="lineNum">      15 </span>                :  *
<span class="lineNum">      16 </span>                :  * Author:         Velez Ezequiel, Peralta Andres
<span class="lineNum">      17 </span>                :  * E-Mail:
<span class="lineNum">      18 </span>                :  *
<span class="lineNum">      19 </span>                :  * ASO is free software: you can redistribute it and/or modify
<span class="lineNum">      20 </span>                :  * it under the terms of the GNU General Public License as published by
<span class="lineNum">      21 </span>                :  * the Free Software Foundation, either version 3 of the License, or
<span class="lineNum">      22 </span>                :  * (at your option) any later version.
<span class="lineNum">      23 </span>                :  *
<span class="lineNum">      24 </span>                :  * ASO is distributed in the hope that it will be useful,
<span class="lineNum">      25 </span>                :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
<span class="lineNum">      26 </span>                :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
<span class="lineNum">      27 </span>                :  * GNU General Public License for more details.
<span class="lineNum">      28 </span>                :  *
<span class="lineNum">      29 </span>                :  * You should have received a copy of the GNU General Public License
<span class="lineNum">      30 </span>                :  * along with ASO.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
<span class="lineNum">      31 </span>                :  *
<span class="lineNum">      32 </span>                :  */
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span>                : #ifndef THERAPY_H
<span class="lineNum">      35 </span>                : #define THERAPY_H
<span class="lineNum">      36 </span>                : 
<span class="lineNum">      37 </span>                : #include &lt;mili/mili.h&gt;
<span class="lineNum">      38 </span>                : #include &quot;common_types.h&quot;
<span class="lineNum">      39 </span>                : #include &quot;combinatory_policy.h&quot;
<span class="lineNum">      40 </span>                : #include &quot;antiviral_set.h&quot;
<span class="lineNum">      41 </span>                : 
<span class="lineNum">      42 </span>                : 
<span class="lineNum">      43 </span>                : /*! Informacion adicional a un nodo */
<span class="lineNum">      44 </span>                : struct Info
<span class="lineNum">      45 </span>                : {
<span class="lineNum">      46 </span>                :     virtual const std::string&amp; get_info() const = 0;
<span class="lineNum">      47 </span>                : };
<span class="lineNum">      48 </span>                : 
<span class="lineNum">      49 </span>                : /*! Definicion de la clase TherapyNode */
<span class="lineNum">      50 </span>                : class TherapyNode
<span class="lineNum">      51 </span>                : {
<span class="lineNum">      52 </span>                : protected:
<span class="lineNum">      53 </span>                :     typedef std::list&lt;TherapyNode*&gt; ChildrenList;
<span class="lineNum">      54 </span>                :     typedef AutonomousIterator&lt;ChildrenList&gt;  ChildrenIterator;
<span class="lineNum">      55 </span>                : 
<span class="lineNum">      56 </span>                :     const size_t id;                       //! identificador único
<span class="lineNum">      57 </span>                :     TherapyNode* parent;                   //! puntero a nodo padre
<span class="lineNum">      58 </span>                :     Info* info;                            //! info extra del nodo
<span class="lineNum">      59 </span>                :     CombinatoryPolicy* combPolicy;         //! politica combinatoria
<span class="lineNum">      60 </span>                : 
<span class="lineNum">      61 </span>                : public:
<span class="lineNum">      62 </span>                :     typedef CAutonomousIterator&lt;ChildrenList&gt; ConstChildrenIterator;
<span class="lineNum">      63 </span>                : 
<span class="lineNum">      64 </span>                :     const NucSequence sequence;         //! secuencia de la mutante que representa
<span class="lineNum">      65 </span>                :     AntiviralSet antivirals;            //! conjunto de antivirales
<span class="lineNum">      66 </span>                :     const DistanceValue value;          //! distancia entre mutanciones
<span class="lineNum">      67 </span>                : 
<span class="lineNum">      68 </span>                :     /*! Constructor */
<span class="lineNum">      69 </span>                :     TherapyNode(const NucSequence&amp; sequence, TherapyNode *parent, const AntiviralSet&amp; av, DistanceValue value, const size_t id, CombinatoryPolicy* comb):
<span class="lineNum">      70 </span>                :             id(id), parent(parent), info(NULL), combPolicy(comb), sequence(sequence), antivirals(av), value(value)
<span class="lineNum">      71 </span>                :     {}
<span class="lineNum">      72 </span>                : 
<span class="lineNum">      73 </span>                :     /*! Constructor de copia */
<span class="lineNum">      74 </span>                :     TherapyNode(const TherapyNode&amp; other)
<span class="lineNum">      75 </span>                :             : id(other.id), parent(other.parent), info(NULL), combPolicy(other.combPolicy), sequence(other.sequence), antivirals(other.antivirals), value(other.value)
<a name="76"><span class="lineNum">      76 </span>                :     {}</a>
<span class="lineNum">      77 </span>                : 
<span class="lineNum">      78 </span><span class="lineCov">           1752 :     ~TherapyNode()</span>
<span class="lineNum">      79 </span><span class="lineCov">           1752 :     {}</span>
<span class="lineNum">      80 </span>                : 
<span class="lineNum">      81 </span>                :     /*! Operador de Equivalencia */
<span class="lineNum">      82 </span>                :     inline bool operator==(const TherapyNode&amp; other) const
<span class="lineNum">      83 </span>                :     {
<span class="lineNum">      84 </span>                :         return id == other.id;
<span class="lineNum">      85 </span>                :     }
<a name="86"><span class="lineNum">      86 </span>                : </a>
<span class="lineNum">      87 </span>                :     /*! Obtener el id */
<span class="lineNum">      88 </span><span class="lineCov">            626 :     inline size_t get_id() const</span>
<span class="lineNum">      89 </span>                :     {
<span class="lineNum">      90 </span><span class="lineCov">            626 :         return id;</span>
<span class="lineNum">      91 </span>                :     }
<span class="lineNum">      92 </span>                : 
<span class="lineNum">      93 </span>                :     /*! Es nodo hoja? */
<span class="lineNum">      94 </span>                :     //bool is_leaf() const;
<span class="lineNum">      95 </span>                : 
<span class="lineNum">      96 </span>                :     /*! Es nodo raiz? */
<span class="lineNum">      97 </span>                :     bool is_root() const;
<a name="98"><span class="lineNum">      98 </span>                : </a>
<span class="lineNum">      99 </span>                :     /*! Obtener un nodo padre */
<span class="lineNum">     100 </span><span class="lineCov">           1395 :     inline TherapyNode* get_parent() const</span>
<span class="lineNum">     101 </span>                :     {
<span class="lineNum">     102 </span><span class="lineCov">           1395 :         return parent;</span>
<span class="lineNum">     103 </span>                :     }
<a name="104"><span class="lineNum">     104 </span>                : </a>
<span class="lineNum">     105 </span>                :     /*! Asignar un nodo padre */
<span class="lineNum">     106 </span><span class="lineCov">           1001 :     inline void set_parent(TherapyNode* newParent)</span>
<span class="lineNum">     107 </span>                :     {
<span class="lineNum">     108 </span><span class="lineCov">           1001 :         parent = newParent;</span>
<span class="lineNum">     109 </span><span class="lineCov">           1001 :     }</span>
<span class="lineNum">     110 </span>                : 
<span class="lineNum">     111 </span>                :     /*! Asignar informacion extra en el nodo */
<span class="lineNum">     112 </span>                :     inline void set_info(Info* infoNode)
<span class="lineNum">     113 </span>                :     {
<span class="lineNum">     114 </span>                :         info = infoNode;
<span class="lineNum">     115 </span>                :     }
<span class="lineNum">     116 </span>                : 
<span class="lineNum">     117 </span>                :     /*! Obtener informacion extra del nodo */
<span class="lineNum">     118 </span>                :     inline const std::string&amp; get_info()
<span class="lineNum">     119 </span>                :     {
<span class="lineNum">     120 </span>                :         return info-&gt;get_info();
<span class="lineNum">     121 </span>                :     }
<a name="122"><span class="lineNum">     122 </span>                : </a>
<span class="lineNum">     123 </span>                :     /*! Retorna la politica combinatoria a aplicar */
<span class="lineNum">     124 </span><span class="lineCov">            313 :     inline CombinatoryPolicy* get_combination_policy() const</span>
<span class="lineNum">     125 </span>                :     {
<span class="lineNum">     126 </span><span class="lineCov">            313 :         return combPolicy;</span>
<span class="lineNum">     127 </span>                :     }
<span class="lineNum">     128 </span>                : 
<span class="lineNum">     129 </span>                :     inline void set_combination_policy(CombinatoryPolicy* comb)
<span class="lineNum">     130 </span>                :     {
<span class="lineNum">     131 </span>                :         combPolicy = comb;
<span class="lineNum">     132 </span>                :     }
<span class="lineNum">     133 </span>                : 
<span class="lineNum">     134 </span>                :     /* Retorna un clon del therapy node que lo invoca */
<span class="lineNum">     135 </span>                :     virtual TherapyNode* clone() const = 0;
<span class="lineNum">     136 </span>                :     /* Función que asigna puntaje a las terapias */
<span class="lineNum">     137 </span>                :     virtual Score scoring() const = 0;
<span class="lineNum">     138 </span>                :     /* Retorna true si la terapia se debe continuar, false de otro modo */
<span class="lineNum">     139 </span>                :     virtual TherapyStatus continue_therapy() const = 0;
<span class="lineNum">     140 </span>                :     /* Permite cambiar el combinador de AV en caso de fallo virologico */
<span class="lineNum">     141 </span>                :     virtual CombinatoryPolicy* virologic_failure(const CombinationStatus&amp; status) = 0;
<span class="lineNum">     142 </span>                : };
<span class="lineNum">     143 </span>                : 
<span class="lineNum">     144 </span>                : /*! Definicion de la Clase Therapy*/
<span class="lineNum">     145 </span>                : class Therapy : public std::list&lt;TherapyNode*&gt;
<span class="lineNum">     146 </span>                : {
<a name="147"><span class="lineNum">     147 </span>                : public:</a>
<span class="lineNum">     148 </span>                :     /*! Constructor */
<span class="lineNum">     149 </span><span class="lineCov">            394 :     Therapy(TherapyNode* last_node)</span>
<span class="lineNum">     150 </span><span class="lineCov">            394 :     {</span>
<span class="lineNum">     151 </span><span class="lineCov">            394 :         const TherapyNode* aux = last_node;</span>
<span class="lineNum">     152 </span><span class="lineCov">           2183 :         while (aux != NULL)</span>
<span class="lineNum">     153 </span>                :         {
<span class="lineNum">     154 </span><span class="lineCov">           1395 :             TherapyNode* aux2 = aux-&gt;clone();</span>
<span class="lineNum">     155 </span><span class="lineCov">           1395 :             if (!empty())</span>
<span class="lineNum">     156 </span>                :             {
<span class="lineNum">     157 </span><span class="lineCov">           1001 :                 TherapyNode* aux3 = front();</span>
<span class="lineNum">     158 </span><span class="lineCov">           1001 :                 aux3-&gt;set_parent(aux2);</span>
<span class="lineNum">     159 </span>                :             }
<span class="lineNum">     160 </span><span class="lineCov">           1395 :             push_front(aux2);</span>
<span class="lineNum">     161 </span><span class="lineCov">           1395 :             aux = aux-&gt;get_parent();</span>
<span class="lineNum">     162 </span>                :         }
<a name="163"><span class="lineNum">     163 </span><span class="lineCov">            394 :     }</span></a>
<span class="lineNum">     164 </span>                :     /*! Destructor */
<span class="lineNum">     165 </span><span class="lineCov">            394 :     ~Therapy()</span>
<span class="lineNum">     166 </span>                :     {
<span class="lineNum">     167 </span><span class="lineCov">            394 :         delete_container(static_cast&lt;std::list&lt;TherapyNode*&gt;&amp;&gt;(*this));</span>
<span class="lineNum">     168 </span><span class="lineCov">            394 :     }</span>
<span class="lineNum">     169 </span>                : 
<span class="lineNum">     170 </span>                :     /*! Imprimir una terapia */
<span class="lineNum">     171 </span>                :     void get_antivital_names(std::string&amp; output) const;
<span class="lineNum">     172 </span>                : };
<span class="lineNum">     173 </span>                : 
<span class="lineNum">     174 </span>                : //! iterador constante de terapias.
<span class="lineNum">     175 </span>                : typedef CAutonomousIterator&lt;Therapy&gt; TherapyIterator;
<span class="lineNum">     176 </span>                : 
<span class="lineNum">     177 </span>                : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../../../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.7</a></td></tr>
  </table>
  <br>

</body>
</html>
